package com.first.statistics.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.first.common.pojo.EduCourse;
import com.first.common.pojo.Order;
import com.first.statistics.dao.EduCourseDao;
import com.first.statistics.service.EduCourseService;
import com.first.statistics.vo.EduCourseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * @program: SecondProject
 * @description:
 * @author: 李榕轩
 * @create: 2023-05-29 14:59
 **/
@Service
public class EduCourseServiceImpl implements EduCourseService {
    @Autowired
    private EduCourseDao educourseDao;
    @Override
    public List<EduCourse> queryAllCourseRanking(EduCourseVo eduCourseVo) {
        QueryWrapper<EduCourse> wrapper = new QueryWrapper<>();
        /*String createTimeStart = eduCourseVo.getGmtCreate();
        String createTimeEnd = eduCourseVo.getGmtModified();*/
        /*if (StrUtil.isNotBlank(eduCourseVo.getGmtCreate()) && StrUtil.isNotBlank(eduCourseVo.getGmtModified()) ){
            wrapper.between("gmt_create",eduCourseVo.getGmtCreate(),eduCourseVo.getGmtModified());
        }*/
        if (StringUtils.hasText(eduCourseVo.getGmtCreate())) {
           wrapper.ge("gmt_create", eduCourseVo.getGmtCreate());
            }
        if (StringUtils.hasText(eduCourseVo.getGmtModified())){
          wrapper.le("gmt_modified", eduCourseVo.getGmtModified());
            }
        List<EduCourse> eduCourses = educourseDao.selectList(wrapper);
        return eduCourses;
    }
}
